package com.lj.mcore.entity;

import com.lj.mcore.domain.IdEntity;
import jakarta.persistence.*;

import java.math.BigDecimal;

@Entity
@Table(name="shopping_goodstock")
public class GoodsStock extends IdEntity {

    @Version
    Long version;

    @Column(columnDefinition="int default 0")
    Integer stock;

    @Column(name = "[key]")
    String key;

    String idPath;

    String name;

    //商品货号
    String serial;

    /**
     * 商品规则配置类型 0全局配置对应库存 1 规格配置对应库存
     */
    @Column(columnDefinition="int default 0")
    int type;

    @ManyToOne(fetch= FetchType.LAZY)
    Goods goods;

    /**
     * 商品价格
     */
    @Column(precision=12, scale=2)
    private BigDecimal price;

    public String getSerial() {
        return serial;
    }

    public void setSerial(String serial) {
        this.serial = serial;
    }

    public String getIdPath() {
        return idPath;
    }

    public void setIdPath(String idPath) {
        this.idPath = idPath;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Long getVersion() {
        return version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }

    public Integer getStock() {
        return stock;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public Goods getGoods() {
        return goods;
    }

    public void setGoods(Goods goods) {
        this.goods = goods;
    }
}
